package com.cn.onetrip.adapter;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import javax.crypto.spec.IvParameterSpec;

import org.json.JSONException;
import org.json.JSONObject;

import com.cn.onetrip.activity.R;
import com.cn.onetrip.objects.RouteItemObj;
import com.cn.onetrip.untility.DebugUtil;
import com.cn.onetrip.untility.SyncImageLoader;
import com.cn.onetrip.untility.SyncImageLoader.OnImageLoadListener;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

public class InfoFeastItemAdapter extends BaseAdapter {

	public Vector<String> mModels = new Vector<String>();
	private LayoutInflater mInflater;
	private Context mContext;
	private ListView mListView;
	private Handler mhandler;

	public InfoFeastItemAdapter(Context context, ListView listView,
			Handler handler) {
		mInflater = LayoutInflater.from(context);
		mContext = context;
		mListView = listView;
		mhandler = handler;
	}

	public void addTitleText(String srcTextInt) {
		mModels.add(srcTextInt);
	}

	public void clean() {
		mModels.clear();
	}

	@Override
	public int getCount() {
		return mModels.size();
	}

	@Override
	public Object getItem(int position) {
		if (position >= getCount()) {
			return null;
		}
		return mModels.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		String srcTextInt = mModels.get(position);
		convertView = mInflater.inflate(R.layout.info_feast_list_items, null);
		convertView.setTag(position);
		TextView title = (TextView) convertView
				.findViewById(R.id.InfoFeastItemTitle);
		TextView text = (TextView) convertView
				.findViewById(R.id.InfoFeastItemText);
		title.setText(srcTextInt);
		return convertView;
	}

}
